aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/nanopb NANOPB_SRCS)

SET(DAEMON_SRCS 
    somb_conf.c
    somb_log.c
    somb_daemon.c
    somb_daemon.pb.c
    somb_daemon_message.c)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(somb_daemon ${DAEMON_SRCS} ${NANOPB_SRCS})
target_link_libraries(somb_daemon pthread yaml)
INSTALL(TARGETS somb_daemon DESTINATION ${PROJECT_INSTALL_PREFIX}/bin)

SET(SOMB_CTRL_SRCS
    somb_daemon.pb.c
    somb_ctrl.c)

add_executable(somb_ctrl ${SOMB_CTRL_SRCS} ${NANOPB_SRCS})
#target_link_libraries(somb_ctrl nanopb)
INSTALL(TARGETS somb_ctrl DESTINATION ${PROJECT_INSTALL_PREFIX}/bin)


SET(SOMB_LIB_SRCS
    somb_conf.c
    somb_log.c
    somb_daemon.pb.c
    somb_lib.c
    somb_lock.c
    somb_manager.c
    somb_message.c
    somb_sock.c
    somb_work.c
    message_queue.c)

add_library(somb SHARED ${SOMB_LIB_SRCS} ${NANOPB_SRCS})
target_link_libraries(somb pthread yaml)
INSTALL(TARGETS somb DESTINATION ${PROJECT_INSTALL_PREFIX}/lib )
